#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    string countAndSay(int n)
    {
        string s = "1";

        int left = 0;
        int right = 0;
        for (int i = 1; i < n; i++)
        {
            string tmp;
            for (right = 0, left = 0; right < s.size(); right++)
            {

                if (s[right] != s[left])
                {
                    tmp += to_string(right - left) + s[left];
                    left = right;
                    cout << 1111 << endl;
                }
            }
            tmp += to_string(right - left) + s[left];
            s = tmp;

        }
        return s;
    }
};